package com.quad.innovators.salesease.converter;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.quad.innovators.salesease.common.result.PageResultBean;
import com.quad.innovators.salesease.model.entity.warehouse.PurchaseOrder;
import com.quad.innovators.salesease.model.entity.warehouse.PurchaseOrderDetail;
import com.quad.innovators.salesease.model.entity.warehouse.SaleReturnOrder;
import com.quad.innovators.salesease.model.form.warehouse.PurchaseOrderDetailForm;
import com.quad.innovators.salesease.model.form.warehouse.PurchaseOrderForm;
import com.quad.innovators.salesease.model.form.warehouse.SaleReturnOrderForm;
import com.quad.innovators.salesease.model.vo.warehouse.PurchaseOrderVO;
import com.quad.innovators.salesease.model.vo.warehouse.SaleReturnOrderVO;

import org.mapstruct.InheritInverseConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

/**
 * @author : shanshan.li
 * @createTime : 2024/12/18 16:04
 * @Version : 1.0 
 */
@Mapper(componentModel = "spring")
public interface SaleReturnOrderConverter {

    @Mappings({
            @Mapping(target = "items", source = "records"),
            @Mapping(target = "pageInfo.currPage", source = "current"),
            @Mapping(target = "pageInfo.totalCount", source = "total"),
            @Mapping(target = "pageInfo.pageSize", source = "size")
    })
    PageResultBean<SaleReturnOrderVO> toPageVo(Page<SaleReturnOrderVO> bo);

    SaleReturnOrderForm toForm(SaleReturnOrder entity);

    @InheritInverseConfiguration(name = "toForm")
    SaleReturnOrder toEntity(SaleReturnOrderForm entity);
}
